import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/res/gaps.dart';
import 'package:ls_work/viewmodel/send_order/send_order_view_model.dart';

class SendOrderFragment extends BaseStatefulMvvmWidget{
  @override
  State<StatefulWidget> createState() =>_SendOrderState();

}

class _SendOrderState extends BaseMvvmState<SendOrderViewModel,SendOrderFragment>{
  @override
  Widget buildLoadingContentView() {
    return ListView(
      children: [
        IconTitleTextWidget('部门：',text: viewModel.departmentName,hintText: '请选择部门',)
        .onTap(() {
          viewModel.selectDepartment();
        }),
        Gaps.dividerLine,
        IconTitleTextWidget('责任人：',text: viewModel.personName,hintText: '请选择责任人',)
        .onTap(() {
          viewModel.selectDepartment();
        }),
        Container(height: 15,),
        ElevatedButton(onPressed: (){
          viewModel.sendOrder();
        }, child: Text('提交'),
        style: ButtonStyle(
          shape: WidgetStateProperty.all(StadiumBorder()),
        ),).addToContainer(margin: EdgeInsets.symmetric(vertical: 10,horizontal: 16))
      ],
    ).addToContainer(color: Colors.white);
  }

  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    return loadingContentWidget;
  }

  @override
  SendOrderViewModel createViewModel() {
   return SendOrderViewModel(context);
  }

  @override
  void onRetryClick() {
  }
  
}